#include "driver/gpio.h"
#include "gpio.h"


#define RELAY                13
#define POWER                15
#define MUTE                 2

void gpio_set_out()
{
    gpio_config_t io_conf;
    //disable interrupt
    io_conf.intr_type = GPIO_PIN_INTR_DISABLE;
    //set as output mode
    io_conf.mode = GPIO_MODE_OUTPUT;
    //bit mask of the pins that you want to set,e.g.GPIO18/19
    io_conf.pin_bit_mask = (1 << POWER) | (1 << MUTE) | (1 << RELAY);
    //disable pull-down mode
    io_conf.pull_down_en = 0;
    //disable pull-up mode
    io_conf.pull_up_en = 0;
    //configure GPIO with the given settings
    gpio_config(&io_conf);

    gpio_set_level(RELAY, 1);
    gpio_set_level(POWER, 0);
    gpio_set_level(MUTE, 0);
}

void set_power_on()
{
    gpio_set_level(POWER, 1);
}

void set_power_down()
{
    gpio_set_level(POWER, 0);
}

void set_mute_on()
{
    gpio_set_level(MUTE, 0);
}

void set_mute_off()
{
    gpio_set_level(MUTE, 1);
}

void set_relay_on()
{
    gpio_set_level(RELAY, 0);
}

void set_relay_off()
{
    gpio_set_level(RELAY, 1);
}




